package org.atguigu.util;

import org.atguigu.entity.TUser;
import org.springframework.security.core.context.SecurityContextHolder;

public class LoginInfoUtil {
    /**
     * 获取登录的用户信息
     *
     * @return
     */
    public static TUser getCurrentLoginUser() {
//        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
//        TUser tUser = (TUser) authentication.getPrincipal();
        return (TUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
}
